cc = g++
prom = texter
tprom = test/tester
deps = $(shell find ./src -name "*.h")
source = $(shell find ./src -name "*.cpp" -and -not -name "main.cpp")
obj = $(source:%.cpp=%.o)
mainsrc = src/main.cpp
main = src/main.o
testsrc = test/test.cpp
testo = test/test.o
flag = -std=c++11

$(prom): $(main) $(obj)
	$(cc) $(flag) -o $(prom) $(main) $(obj)

$(main): $(mainsrc) $(deps)
	$(cc) $(flag) -c $(mainsrc) -o $(main)

%.o: %.cpp $(deps)
	$(cc) $(flag) -c $< -o $@

$(tprom): $(testo) $(obj)
	$(cc) $(flag) -o $(tprom) $(testo) $(obj)

test: $(tprom)
	./$(tprom)

$(testo) : $(testsrc) $(deps)
	$(cc) $(flag) -c $(testsrc) -o $(testo)

clean:
	rm -rf $(main) $(testo) $(obj) $(prom) $(tprom)
